# This file is part of BlackArch Linux ( https://www.blackarch.org/ ).
# See COPYING for license details.

pkgbase=python-py-radix
pkgname=('python2-py-radix' 'python-py-radix')
_pkgname=py-radix
pkgver=0.10.0
pkgrel=9
pkgdesc='Radix tree implementation.'
arch=('x86_64' 'aarch64')
url='https://pypi.org/project/py-radix/#files'
license=('BSD')
makedepends=('python2-setuptools' 'python-setuptools')
source=("https://files.pythonhosted.org/packages/source/${_pkgname::1}/$_pkgname/$_pkgname-$pkgver.tar.gz")
sha512sums=('fb18178c6546475c1bae5f0e0553c844ac2edc4868f8fa7a7a455c3822998f0925b42aae629d085455aa94e4a980c0da3541c708f42835e91805f77196dbf4e3')

prepare() {
  cp -a "$_pkgname-$pkgver"{,-2}
}

build() {
  cd "$_pkgname-$pkgver-2"

  python2 setup.py build

  cd "$srcdir/$_pkgname-$pkgver"

  python setup.py build
}

package_python2-py-radix() {
  depends=('python2')

  cd "$_pkgname-$pkgver-2"

  python2 setup.py install --prefix=/usr --root="$pkgdir" --optimize=1 \
    --skip-build
}

package_python-py-radix() {
  depends=('python')

  cd "$_pkgname-$pkgver"

  python setup.py install --prefix=/usr --root="$pkgdir" --optimize=1 \
    --skip-build
}

